<template>
    <Layout>
        <Form ref="form1" :model="form1" :label-width="120">
            <Row class="query-form">
                <Col span="8">
                    <FormItem label="二级集团：">
                        <two-level-org org-code class="query-form-el" v-model="form1.twoLevelOrgCode" />
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label="单位名称：" prop="order">
                        <company-select v-model="form1.companyName" style="width:100%" />
                        <!-- <cascader-dom class="query-form-el" ref='queryOrgCascader' @setOrgname='setQueryOrgName'
                                      :orgTree="true"
                                      :setCurrentName="{label:form1.companyName,value:form1.companyId}"></cascader-dom> -->
                    </FormItem>
                </Col>
                <Col v-if="!switchFlag"  span="8">
                    <Button @click="switchQuery(true)" class="ivu-btn-switch" type="text">展开∨</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button class="ivu-btn-query" icon="md-search" @click="query()">查询</Button>
                </Col>
                <Col v-else span="8">
                    <FormItem label="事故名称：">
                        <Input type="text" v-model="form1.victim"></Input>
                    </FormItem>
                </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
                <Col span="8">
                    <FormItem label="事故类别：">
                        <Select v-model="form1.accTypeId"  >
                            <Option v-for="item in typeList" :value="item.codingCodeId" :key="item.codingCodeId">{{  item.codingName  }}</Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span="8" offset="8">
                    <Button @click="switchQuery(false)" class="ivu-btn-switch" type="text">收起∧</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                </Col>
            </Row>
            <Row class="query-form">
                <Col span="24">
                    <Button size="large" class="ivu-btn-add" icon="md-add" @click="addInfo">新增</Button>
                    <download-button :api="exportUrl" :queryForm='form1' />
                </Col>
            </Row>
        </Form>
        <Table ref='table' :height="tableHeight" :loading="loading" size="small" class="table" no-data-text="没有查询到相关数据!"
            @on-sort-change="sortChange"       
            highlight-row stripe border :columns="columns1" width="100%" :data="dataTable">
        </Table>
        <Row style="margin-right:10px;">
            <Col span="24">
                <Page :total="pagedata.total" :page-size="pagedata.pageSize" @on-change="pageChange"
                      style="float: right" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray"
                      show-total show-sizer show-elevator/>
            </Col>
        </Row>

        <Modal :transfer=false :mask-closable="false" v-model="model1" :width=850 :title="add?'事故补报新增':'事故补报修改'"
               :styles="{height:'600px'}" class-name='limit-height-dialog'  @on-cancel="onCancel">
            <div>
                <Form ref='InputData' :model="InputData" :rules="ruleCustom" label-position="top">
                    <div style="margin-left: 20px">
                        <Row>
                            <Col span='23'>
                                <FormItem label="事故名称：" prop="briefId">
                                    <Input v-model="InputData.sartName" placeholder="请选择事故名称" :readonly="true">
                                    <Button slot="append" @click="openForSelect" icon="ios-search"></Button>
                                    </Input>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row>
                            <Col span='11'>
                                <FormItem label="事故类别：" prop="accTypeId">
                                    <Input v-model="InputData.accTypeName" placeholder="请选择事故名称" :readonly="true"/>
                                    <Input v-show="false" v-model="InputData.accTypeId" placeholder="请选择事故名称" :readonly="true"/>
                                </FormItem>
                            </Col>
                            <Col span='11'  offset="1">
                                <FormItem label="事故时间：" prop="sartDate">
                                    <DatePicker v-model="InputData.sartDate" type="date" style="width: 100%;"
                                                placeholder="请输入" :readonly="true"></DatePicker>
                                </FormItem>
                            </Col>
                        </Row>
                       <!--<Row>-->
                           <!--<Col span='11' >-->
                               <!--<FormItem label="事故时间：" prop="sartDate">-->
                                   <!--<DatePicker v-model="InputData.sartDate" type="date" style="width: 100%;"-->
                                               <!--placeholder="请输入" :readonly="true"></DatePicker>-->
                               <!--</FormItem>-->
                           <!--</Col>-->
                           <!--<Col span='11' offset="1">-->
                               <!--<FormItem label="事故类别：" prop="accTypeName">-->
                                   <!--<Input v-model="InputData.accTypeName" type="text" :readonly="true"/>-->
                               <!--</FormItem>-->
                           <!--</Col>-->

                       <!--</Row>-->
                      <!--<Row>-->
                          <!--<Col span='11' >-->
                              <!--<FormItem label="就业类型：" prop="membershipName">-->
                                  <!--<Input v-model="InputData.membershipName" type="text" :readonly="true"/>-->
                              <!--</FormItem>-->
                          <!--</Col>-->
                          <!--<Col span='11' offset="1">-->
                              <!--<FormItem label="最终伤害程度：" prop="injuryDegreeId">-->
                                  <!--<Select v-model="InputData.injuryDegreeId"    >-->
                                      <!--<Option v-for="item in injuryLeveList" :value="item.codingCodeId"  :key="item.codingCodeId">{{  item.codingName  }}</Option>-->
                                  <!--</Select>-->
                              <!--</FormItem>-->
                          <!--</Col>-->
                      <!--</Row>-->
                        <Row v-if="InputData.sartName">
                            <Col span="23" class="query-form">
                                <p>事故伤亡人员信息</p>
                                <Table highlight-row stripe border style="margin-top:10px;margin-bottom: 10px" :max-height="350" :columns="columnsItem"
                                       :data="InputData.briefItems">
                                </Table>
                            </Col>
                        </Row>
                      <Row>
                          <Col span='11' >
                              <FormItem label="补报人：" prop="userName">
                                  <Input v-model="InputData.userName" type="text" :readonly="true"/>
                              </FormItem>
                          </Col>
                          <Col span='11' offset="1">
                              <FormItem label="补报时间：" prop="createDate">
                                  <DatePicker v-model="InputData.createDate" type="date" style="width: 100%;"
                                              :readonly="true"  placeholder="请输入" ></DatePicker>
                              </FormItem>
                          </Col>
                      </Row>
                       <Row>
                           <Col span='23'>
                               <FormItem label='事故补充描述：' >
                                   <Input v-model="InputData.finalReportDesc" type="textarea"
                                          :autosize="{minRows:2,maxRows:5}" />
                               </FormItem>
                           </Col>
                       </Row>
                      <Row>
                          <Col span="23">
                              <FormItem label="补报附件：">
                                  <div>
                                      <Upload ref="upload"
                                              :before-upload="beforeUpload"
                                              :show-upload-list="true"
                                              :max-size="10240"
                                              multiple
                                              type="drag"
                                              :action="fileUrl">
                                          <div style="padding: 10px">
                                              <Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>
                                              <p>点击将文件拖拽到这里上传</p>
                                              <span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>
                                          </div>
                                      </Upload>
                                  </div>
                                  <div v-show="uploadList.length>0" v-for="item in uploadList" :key='item'>
                                      <a @click="downloadFile(InputData.id,item)">{{ item.fileName }}</a>
                                      <Button type="text" icon="md-trash" @click="remove1(item.id)" style="margin-left: 5px;margin-bottom: 3px" />
                                  </div>
                              </FormItem>
                          </Col>
                      </Row>
                    </div>
                </Form>
            </div>
            <div slot="footer">
                <Button class='ivu-btn-save' :loading="buttonLoading" @click="submit('InputData')">确定</Button>
                <Button class='ivu-btn-cancel' @click="onCancel">取消</Button>
            </div>
        </Modal>

        <Modal :transfer=false v-model="model3" :width=850 title="事故补报详情" @on-cancel="onCancel" :styles="{height:'600px'}" class-name='limit-height-dialog' >
            <Form :model="InputData" label-position="top">
              <div>
                  <Row style="line-height: 42px;margin-left: 20px">
                      <Col span='23'>
                          <span>事故名称：{{InputData.sartName}}</span>
                      </Col>
                  </Row>
                  <Row style="line-height: 42px;margin-left: 20px" class="detail-background-clor">
                      <Col span='11' >
                          <span>事故类别：{{InputData.accTypeName}}</span>
                      </Col>
                      <Col span='11' offset="1">
                          <span>事故时间：{{ this.formatDate(new Date(InputData.sartDate),'yyyy-MM-dd')}}</span>
                      </Col>
                  </Row>

                  <Row >
                      <Col span="23" class="query-form" style="margin-left: 20px">
                          <p>事故伤亡人员信息</p>
                          <Table highlight-row stripe border style="margin-top:10px;margin-bottom: 10px" :max-height="350" :columns="columnsItem"
                                 :data="InputData.briefItems">
                          </Table>
                      </Col>
                  </Row>
                    <Row class="detail-background-clor" style="line-height: 42px;margin-left: 20px">
                        <Col span='11'>
                            <span>补报人：{{InputData.userName}}</span>
                        </Col>
                        <Col span='11' >
                            <span>补报时间：{{this.formatDate(new Date(InputData.createDate),'yyyy-MM-dd')}}</span>
                        </Col>
                    </Row>
                    <Row >
                        <Col span="23" style="line-height: 42px;margin-left: 20px">
                            <FormItem label="补报附件：">
                                <div v-show="uploadList.length>0" v-for="item in uploadList" :key='item'>
                                    <a @click="downloadFile(InputData.id,item)">{{ item.fileName }}</a>
                                </div>
                            </FormItem>
                        </Col>
                    </Row>

                    <Row style="line-height: 42px;margin-left: 20px">
                        <Col span='23' class="detail-background-clor">
                            <span>事故补充描述：{{InputData.finalReportDesc}}</span>
                        </Col>
                    </Row>


              </div>
            </Form>
            <div slot="footer">
                <Button class='ivu-btn-save' @click="onCancel">关闭</Button>
            </div>
        </Modal>

        <Modal title="事故简报" :transfer=false footer-hide v-model="briefingList" :width=900>
            <FollowReportForSelect @getSelectData="getSelectData">
            </FollowReportForSelect>
        </Modal>
    </Layout>
</template>

<script>
import {Api} from '../../../../api/index.js'
import {sessionStorage} from '../../../../common/cacheUtils.js';
import FollowReportForSelect from '../followReport/followReportForSelect.vue';
import cascaderDom from "../../../../components/cascader-dom.vue"

export default {
        components: {FollowReportForSelect, cascaderDom},
        data() {
            return {
                exportUrl: Api.queryFinalReport+ '/export',
                briefingList: false,
                uploadList: [],
                tableHeight: '',
                loading: false,
                form1: {},
                pageSizeArray: [10, 20, 50],
                pagedata: {
                    total: 0,
                    pageSize: 10,
                    currentPage: 1,
                },
				currentUser: JSON.parse(sessionStorage('userId').get('userId')),
                dataTable: [],
                ruleCustom: {

                    briefId: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.briefId == null || this.InputData.briefId  == '' || this.InputData.briefId  == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    position: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.position == null || this.InputData.position == '' || this.InputData.position == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    sartDate: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.sartDate == null || this.InputData.sartDate == '' || this.InputData.sartDate == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    accTypeName: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.accTypeName == null || this.InputData.accTypeName == '' || this.InputData.accTypeName == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    injuryDegreeId: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.injuryDegreeId == null || this.InputData.injuryDegreeId == '' || this.InputData.injuryDegreeId == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    membershipName: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.membershipName == null || this.InputData.membershipName == '' || this.InputData.membershipName == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],

                    completionTime: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                },
                columns1: [
                    {
                        title: "序号",
                        width: 80,
                        align: "center",
                        fixed: 'left',
                        render: (h, params) => {
                            return h('span', params.index + (this.pagedata.currentPage - 1) * this.pagedata.pageSize + 1);
                        }
                    },
                    {title: '事故名称', align: 'center', key: 'sartName', minWidth: 120,},
                    {title: '事故单位', align: 'center', key: 'reportOrgName', minWidth: 150, tooltip: true},
                    // {title: '工种或岗位', align: 'center', key: 'position',},
                    {title: '事故时间', align: 'center', key: 'sartDate',sortable: "custom",
                        render: (h, params) => {return h('div', [(this.formatDate(new Date(params.row.sartDate), 'yyyy-MM-dd'))]);}},
                    {title: '事故类别', align: 'center', key: 'accTypeName',},
                    // {title: '就业类型', align: 'center', key: 'membershipName',},
                    // {title: '最终伤害程度', align: 'center', key: 'injuryDegreeName',},
                    {title: '补报人', align: 'center', key: 'userName',},
                    {title: '补报时间', align: 'center', key: 'createDate',sortable: "custom", render: (h, params) => {
                            return h('div', [(this.formatDate(new Date(params.row.createDate), 'yyyy-MM-dd'))]);}},
                    {
                        title: '操作',
                        key: 'action',
                        fixed: 'right',
                        width: 200,
                        align: 'center',
                        render: (h, params) => {
							let flag = this.currentUser.loginId === this.Common.admin ||
									   this.currentUser.userId === params.row.createUserId  ||
									   this.currentUser.userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined ||
									   this.currentUser.userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined
                            return h('div', [
                                h('A', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                    },
                                    on: {
                                        click: () => {
                                            this.InputData = JSON.parse(JSON.stringify(params.row));
                                            this.getFiles();
                                            this.model3 = true;
                                        }
                                    }
                                }, '详情'), h('Divider', {
                                    props: {
                                        type: 'vertical',
                                    }
                                }, ''),
                                h('A', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
										color:flag?'':'#c5c8ce',
										pointerEvents:flag?'':'none'
                                    },
                                    on: {
                                        click: () => {
                                            this.InputData = JSON.parse(JSON.stringify(params.row));
                                            this.getFiles();
                                            this.model1 = true;
                                            this.add = false
                                        }
                                    }
                                }, '修改'), h('Divider', {
                                    props: {
                                        type: 'vertical',
                                    }
                                }, ''),
                                h('A', {
                                    props: {
                                        type: 'error',
                                        size: 'small'
                                    },
                                    style: {
                                        fontSize: '14px',
                                        color:flag?'red':'#c5c8ce',
                                        pointerEvents:flag?'':'none'
                                    },
                                    on: {
                                        click: () => {
                                            this.$Modal.confirm({
                                                title: '提示',
                                                content: '<p>是否要删除？</p>',
                                                onOk: () =>{
                                                    this.deleteData(params.row);
                                                } ,
                                                onCancel: () => {
                                                }
                                            });
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                add: false,
                InputData: {

                },

                buttonLoading: false,
                model2: false,
                model1: false,
                model3: false,
                typeList: [],
                fileUrl: Api.interestedPartiesUserFile,
                switchFlag:false,
                columnsItem: [
                    // {title: '序号', width: 70, align: 'center', render: this.indexColumnsRender},
                    {title: '伤亡人员姓名', align: 'center', key: 'victim', minWidth: 100,},
                    {title: '性别', align: 'center', key: 'gender', minWidth: 80,render: (h, params) => {
                            return h('span', params.row.gender == '0' ? '男' : '女')}},
                    {title: '年龄', align: 'center', key: 'age', minWidth: 80,},
                    {title: '工种或岗位', align: 'center', key: 'position', minWidth: 120,},
                    {title: '伤害部位', align: 'center', key: 'injured', minWidth: 120,},
                    {title: '就业类型', align: 'center', key: 'membershipName', minWidth: 120,},
                    {title: '伤害程度', align: 'center', key: 'injuryLevelName', minWidth: 120,},
                    {title: '歇工天数', align: 'center', key: 'daysWork', minWidth: 100,},
                    {title: '直接经济损失(万元)', align: 'center', key: 'loseMoney', minWidth: 120,},
                ],
            }
        },
        mounted() {
            this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 145;
            this.query()
            this.selectCodingSort();
        },
        methods: {
            sortChange(data) {
                if (data.order === 'asc'||data.order ==='desc') {
                    let order = data.key
                    this.form1.dynamicSort = order +' '+ data.order
                    this.query()
                }
            },
            setQueryOrgName(data) {
                this.$set(this.form1, "companyName", data);
            },
            openForSelect() {
                this.briefingList = true;
            },
            switchQuery(flag) {
                this.switchFlag = flag;
                if (!this.switchFlag) {
                    this.tableHeight = this.tableHeight + 44;
                } else {
                    this.tableHeight = this.tableHeight - 44;
                }
            },
            getSelectData(row) {
                this.InputData.accTypeName = row.accTypeName
                this.InputData.accTypeId = row.accTypeId
                this.InputData.sartName = row.sartName;
                this.InputData.briefId = row.briefId;
                this.InputData.victim = row.victim;
                this.InputData.damage = row.loseMoney;
                this.InputData.briefItems = row.briefItems;

                this.InputData.sartDate = row.sartDate;
                this.briefingList = false;
            },
            downloadFile(guideId, file) {
                let url = this.fileUrl + '/file/' + file.id;
                this.$http.get(url, {
                    responseType: 'blob'      //告诉服务器我们需要的响应格式
                }).then((res) => {
                    console.log(res)
                    const aLink = document.createElement("a");
                    let blob = new Blob([res.data], {
                        type: res.bodyBlob.type      //将会被放入到blob中的数组内容的MIME类型
                    });
                    aLink.href = URL.createObjectURL(blob)
                    aLink.download = file.fileName //标题
                    aLink.click()
                    document.body.appendChild(aLink)
                })
            },
            remove1(id) {
                console.log(id)
                let url = this.fileUrl + '/file/' + id;
                this.$http.delete(url).then((res) => {
                    this.getFiles()
                })
            },
            beforeUpload(file) {
                console.log(this.uploadList)
                let formData = new FormData();
                formData.append("files", file); // 文件对象
                let url = this.fileUrl + '/' + this.InputData.id + '/files/finalReport'
                this.$http.post(url, formData).then((res) => {
                    if (res.data.result == "success") {
                        this.$Message.info("文件上传成功")
                        this.getFiles();
                    }
                })
                return false
            },
            getFiles() {
                let url = this.fileUrl + '/' + this.InputData.id + '/files/finalReport'
                this.$http.get(url).then((res) => {
                    if (res.data.result == "success") {
                        console.log(res.data)
                        this.uploadList = res.data.data
                    }
                })
            },
            onCancel() {
                this.InputData = {}
                this.model1 = false
                this.model3 = false
                this.query();

            },
            submit(name) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.buttonLoading = true

                        this.InputData.createDate = this.formatDate(new Date(this.InputData.createDate), 'yyyy-MM-dd')
                        if (this.add) {
                            let url = Api.saveFinalReport
                            this.InputData.bsflag = '0'
                            this.InputData.createOrgId = sessionStorage('userId').getObject('userId').orgInfo.orgId
                            this.InputData.createUserId = sessionStorage('userId').getObject('userId').userId
                            this.$http.post(url, this.InputData).then((res) => {
                                this.$Message.success('成功');
                                this.query()
                                this.buttonLoading = false
                                this.model1 = false
                            }).catch(e => {
                                this.$Message.error('请求失败');
                            })
                        } else {
                            let url = Api.updateFinalReport;
                            this.InputData.updateUserId = sessionStorage('userId').getObject('userId').userId
                            this.InputData.updateOrgId = sessionStorage('userId').getObject('userId').orgInfo.orgId
                            this.$http.put(url, this.InputData).then((res) => {
                                this.$Message.success('成功');
                                this.buttonLoading = false
                                this.model1 = false
                                this.query()
                            }).catch(e => {
                                this.$Message.error('请求失败');
                            })
                        }
                    } else {
                        this.$Message.error('失败!');
                    }
                })

            },
            selectCodingSort() {
                this.$http.get(Api.queryCodeDetailBySortId + '/ACC-000001', {params: {}}).then((res) => {
                    this.typeList = res.data.data;
                });
            },

            deleteData(row) {
                let url = Api.deleteFinalReport

                this.$http.delete(url+"/"+row.id).then((res) => {
                    this.$Message.success('成功');
                    this.query()
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },
            addInfo() {
                this.uploadList = [];

                this.add = true;
                this.InputData = {
                    id:this.get_uuid(),
                    userName:sessionStorage('userId').getObject('userId').userName,
                    createDate:new Date(),
                };
                this.model1 = true;
            },
            query() {
                let data = {
                    startPage: this.pagedata.currentPage,
                    size: this.pagedata.pageSize,
                    // orgId: sessionStorage('userId').getObject('userId').companyId,
                };
                data = Object.assign(data, JSON.parse(JSON.stringify(this.form1)));
                let url = Api.queryFinalReport
                this.loading = true;
                this.$http.get(url, {params: data}).then((res) => {
                    this.dataTable = res.data.data.data;
                    this.pagedata.total = res.data.data.totalSize;
                    this.loading = false;
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },
            reset() {
                this.form1 = {};
                this.pagedata.currentPage = 1;
                this.query();
            },

            pageChange(pageNum) {
                this.pagedata.currentPage = pageNum;
                this.query();
            },
            pageSizeChange(pageSize) {
                this.pagedata.pageSize = pageSize;
                this.query();
            },
            get_uuid() {
                let s = [];
                let hexDigits = "0123456789abcdef";
                for (let i = 0; i < 36; i++) {
                    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
                }
                s[14] = "4";
                s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
                s[8] = s[13] = s[18] = s[23] = "-";

                let uuid = s.join("");
                let reg = new RegExp("-", "g");
                let a = uuid.replace(reg, "");
                console.log(a);
                return a;
            },
            formatDate(date, fmt) {
                if (/(y+)/.test(fmt)) {
                    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
                }
                let o = {
                    'M+': date.getMonth() + 1,
                    'd+': date.getDate(),
                    'h+': date.getHours(),
                    'm+': date.getMinutes(),
                    's+': date.getSeconds()
                };
                for (let k in o) {
                    if (new RegExp(`(${k})`).test(fmt)) {
                        let str = o[k] + '';
                        fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : this.padLeftZero(str));
                    }
                }
                return fmt;
            },
            padLeftZero(str) {
                return ('00' + str).substr(str.length);
            },
        },
        watch: {

        },
    }
</script>

<style scoped>
    @import '../../../../index.css';

</style>
